﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_Department_EditCompanyName : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string _companyName = Request.QueryString["CompanyName"].ToString();
        if (!IsPostBack)
        {
            this.txtDepartmentName.Text = _companyName;
        }
    }


    /// <summary>
    /// 确定方法
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// <author>grokyao</author>
    /// <date>2009-2-26</date>
    protected void btnAddAndReturn_Click(object sender, EventArgs e)
    {
        try
        {
            Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
            AppSettingsSection _appSetting = (AppSettingsSection)config.GetSection("appSettings");
            _appSetting.Settings["CompanyName"].Value = this.txtDepartmentName.Text.Trim();
            config.Save();
            Utility.HttpHelp.closeWindow("Department_Manager.aspx", Page);
        }
        catch (System.Exception ee)
        {
            Utility.HttpHelp.alert("修改组织机构有错误，请查看日志",Page);
            Utility.Error.Log(ee.ToString());            
        }
    }

    /// <summary>
    /// 退出方法
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// <author>grokyao</author>
    /// <date>2009-2-26</date>
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Utility.HttpHelp.closeWindow("Department_Manager.aspx", Page);
    }
}
